<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <title>众筹活动列表</title>
    <script src="javascript/jquery.min.js"></script>
    <script src="javascript/function.js"></script>
    <link rel="stylesheet" href="stylesheet/style_v1.1.css">
</head>
<body>
<div class="header-title">
    <a href="javascript:void(0);"  class="fanhui">
        <img src="image/tick.png" alt="">
    </a>
    <p>众筹列表</p>
</div>
<div class="tab-class">
    <ul>
        <li>
            <a href="javascript:void(0);" onclick="queryMyActivityList('1');" class="ac">参与中</a>
        </li>
        <li>
            <a href="javascript:void(0);" onclick="queryMyActivityList('2');">已成功</a>
        </li>
    </ul>
</div>
<div class="con padding-top100 padding-bottom50 padding-lr5" id="activityDetailShow">
</div>
     <%@ include file="footer.jsp"%>
<script>
$(function () {
	  $('.tab-class').find('li').on('click',function(){
          $('.tab-class a').removeClass('ac');
           $(this).find('a').addClass('ac');
       });
	queryMyActivityList("1");
});
function queryMyActivityList(status) {
	var params = "parms.openId=" + "1";
	params += "&parms.status=" + status;
	$.ajax({
				type : 'post',
				url : 'cliffordAction!queryMyActivityList.action',
				async : false,
					data : params, // 传给action的参数
				success : function(data) {
					if (data.result == 1) {
						if (data.resultData.size == '0') {
							document.getElementById("activityDetailShow").innerHTML="";
							if(status=='1'){
								alert("您还没有参与过活动哦~");
							}else if(status=='2'){
								alert("您还没有已成功的活动哦~");
							}else{
								alert("未查询到符合条件的记录");
							}
							
						} else {
							var list = data.resultData.datalist;
							var html = "";
							for ( var i = 0; i < list.length; i++) {
								  html += '    <div class="list-qifu">';
								  html += '    <a href="forwardPageParam_activityDetailCake.action?parms.activityId='+list[i].zjfGoodsActivity.activityId+'">';
								  html += '   <div class="list-img">';
								  html += '    <img src="'+list[i].zjfGoodsActivity.activityImg+'" alt="">';
								  html += '   </div>';
								  html += '    <div class="list-info">';
								  html += '  <p class="list-name">'+list[i].zjfGoodsActivity.activityName+'</p>';
								  html += '  <p class="list-name">参与金额：'+list[i].zjfGoodsActivityRecord.money+'元</p>';
								  if( typeof(list[i].zjfGoodsActivity.discount) != "undefined"){
									  html += '  <p class="list-name">现在折扣：'+list[i].zjfGoodsActivity.discount+'折</p>';
								 	 html += '  <p class="list-name">现在金额：'+(list[i].zjfGoodsActivityRecord.money/(list[i].zjfGoodsActivity.discount/10)).toFixed(2)+'元</p>';
								  }else{
									  html += '  <p class="list-name">现在折扣：6.5折</p>';
									  html += '  <p class="list-name">现在金额：'+(list[i].zjfGoodsActivityRecord.money/(6.5/10)).toFixed(2)+'</p>';
								  }
									  
								  if(status=='1'){
									  html += '    <span class="qifu-rs">进行中</span>';
								  }else if(status=='2'){
									  html += '    <span class="qifu-rs">已成功</span>';
								  }
								
								  html += '     <span class="qifu-rss">'+list[i].zjfGoodsActivityRecord.join_time+'</span>';
								  html += '   </div>';
								  html += '   </a>';
								  html += '   </div>';
							}
							document.getElementById("activityDetailShow").innerHTML = html;
						}
					} else {
						document.getElementById("activityDetailShow").innerHTML="";
						alert(data.msg);
					}
				}
			});
}
function startActivity(goodsId){
alert(goodsId);	
}
</script>
</body>
</html>